<template>
	<view class="dbox">
		<view class="box">
		</view>
	</view>
</template>

<script>
	import {
		mapState,
		mapMutations
	} from 'vuex';
	export default {
		computed: mapState(['hasLogin', 'uerInfo']),
		data() {
			return {

			};
		},
		onLoad() {
			this.getCid()
			const value = uni.getStorageSync('loginstate');
			var device = uni.getSystemInfoSync().platform;
			if(device==='android'){
				uni.setStorageSync('device',0)
			}
			if(device==='ios'){
				uni.setStorageSync('device',1)
			}
			console.log(value)
		
			setTimeout(s => {
				if (value) {
					uni.setStorageSync("yyState",1)
					uni.switchTab({
						url: '../home/home'
					})
				} else {
					uni.navigateTo({
						url: '../login/login2'
					})
				}
			}, 2000)
		},
		methods:{
			getCid() {
				// #ifdef  APP-PLUS
				console.log('获取cid');
				var t1 = setInterval(function() {
					// console.log('定时器');
					//扩展API加载完成事
					var cid = plus.push.getClientInfo().clientid;
					if (cid && cid != null && cid != 'null') {
						try {
							console.log(cid);
							uni.setStorageSync('cid', cid);
							this.cid = cid;
			
						} catch (e) {
							console.log('获取cid失败');
						}
						clearInterval(t1);
					}
				}, 5000);
				// #endif
			},
		}
	}
</script>

<style lang="less" scoped>
	.dbox {
		width: 100vw;
		height: 100vh;
		background-color: #3FA7B9;
		.box {
			width: 90%;
			height: 70%;
			// background: url(../../static/img/b.png) no-repeat bottom center;
			background: url(../../static/img/loading_two.jpg) no-repeat bottom center;
			margin-left: 40rpx;
			background-size: contain;
		}
	}
</style>
